package com.ccut.atpak.utils;

import java.io.File;
import java.util.ArrayList;
import java.util.List;

public class ImageTool {
	public List<String> getImageFromSD(String fUrl) {
		List<String> it = new ArrayList<String>();
		File f = new File(fUrl);
		File[] files = f.listFiles();
		for (int i = 0; i < files.length; i++) {
			File file = files[i];
			if (getImageFile(file.getPath())) {
				it.add(file.getPath());
			}
		}
		return it;
	}

	private boolean getImageFile(String fName) {
		boolean re;
		String end = fName
				.substring(fName.lastIndexOf(".") + 1, fName.length())
				.toLowerCase();
		if (end.equals("jpg") || end.equals("gif") || end.equals("png")
				|| end.equals("jpeg") || end.equals("bmp")) {
			re = true;
		} else {
			re = false;
		}
		return re;
	}
}
